import Vue from "vue";
import VueRouter from "vue-router";
import index from "../views/index/index.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "首页",
    component: index
  },
  {
    path: "/classify",
    name: "分类",
    component: () =>
        import(/* webpackChunkName: "about" */ "../views/classify/classify.vue")
  },
  {
    path: "/car",
    name: "购物车",
    component: () =>
        import(/* webpackChunkName: "about" */ "../views/car/car.vue")
  },
  {
    path: "/my",
    name: "我的",
    component: () =>
        import(/* webpackChunkName: "about" */ "../views/my/my.vue")
  },
  {
    path: "/login",
    name: "登录页",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
        import(/* webpackChunkName: "about" */ "../views/login/login.vue")
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
